home *** CD-ROM | disk | FTP | other *** search
- /*************** -*- Mode: MACSYMA; Package: MAXIMA -*- ******************/
- /***************************************************************************
- *** *****
- *** Copyright (c) 1984 by William Schelter,University of Texas *****
- *** All rights reserved *****
- ***************************************************************************/
-
-
- KILL(FUNCTIONS,ARRAYS,VALUES);
- DONE$
- use_fast_arrays:false;
- false;
- A[N]:=N*A[N-1];
- A[N]:=N*A[N-1]$
- A[0]:1;
- 1$
- A[5];
- 120$
- A[N]:=N;
- A[N]:=N$
- A[6];
- 6$
- A[4];
- 24$
- (use_fast_arrays:true,kill(a));
- done;
- LAMBDA([X,Y,Z],X^2+Y^2+Z^2);
- LAMBDA([X,Y,Z],X^2+Y^2+Z^2)$
- %(1,2,A);
- A^2+5$
- 1+2+A;
- A+3$
- EXP:[X^2,Y/3,-2];
- [X^2,Y/3,-2]$
- %[1]*X;
- X^3$
- [A,EXP,%];
- [A,[X^2,Y/3,-2],X^3]$
- M:MATRIX([A,0],[B,1]);
- MATRIX([A,0],[B,1])$
- M^2;
- MATRIX([A^2,0],[B^2,1])$
- EXP:M . M;
- MATRIX([A^2,0],[A*B+B,1])$
- M[1,1]*M;
- MATRIX([A^2,0],[A*B,A])$
- %-EXP+1;
- MATRIX([1,1],[1-B,A])$
- M^^(-1);
- MATRIX([1/A,0],[-B/A,1])$
- [X,Y] . M;
- MATRIX([B*Y+A*X,Y])$
- MATRIX([A,B,C],[D,E,F],[G,H,I]);
- MATRIX([A,B,C],[D,E,F],[G,H,I])$
- %^^2;
- MATRIX([C*G+B*D+A^2,C*H+B*E+A*B,C*I+B*F+A*C],
- [F*G+D*E+A*D,F*H+E^2+B*D,F*I+E*F+C*D],
- [G*I+D*H+A*G,H*I+E*H+B*G,I^2+F*H+C*G])$
- EXP:X+1 = Y^2;
- X+1 = Y^2$
- X-1 = 2*Y+1;
- X-1 = 2*Y+1$
- EXP+%;
- 2*X = Y^2+2*Y+1$
- EXP/Y;
- (X+1)/Y = Y$
- 1/%;
- Y/(X+1) = 1/Y$
- FIB[N]:=IF N = 1 OR N = 2 THEN 1 ELSE FIB[N-1]+FIB[N-2];
- FIB[N]:=IF N = 1 OR N = 2 THEN 1 ELSE FIB[N-1]+FIB[N-2]$
- FIB[1]+FIB[2];
- 2$
- FIB[3];
- 2$
- FIB[5];
- 5$
- ETA(MU,NU):=IF MU = NU THEN MU ELSE (IF MU > NU THEN MU-NU ELSE MU+NU);
- ETA(MU,NU):=IF MU = NU THEN MU ELSE (IF MU > NU THEN MU-NU ELSE MU+NU)$
- ETA(5,6);
- 11$
- ETA(ETA(7,7),ETA(1,2));
- 4$
- IF NOT 5 >= 2 AND 6 <= 5 OR 4+1 > 3 THEN A ELSE B;
- A$
- KILL(F);
- DONE$
- HESSIAN(F):=BLOCK([DFXX,DFXY,DFXZ,DFYY,DFYZ,DFZZ],DFXX:DIFF(F,X,2),
- DFXY:DIFF(F,X,1,Y,1),DFXZ:DIFF(F,X,1,Z,1),DFYY:DIFF(F,Y,2),
- DFYZ:DIFF(F,Y,1,Z,1),DFZZ:DIFF(F,Z,2),
- DETERMINANT(MATRIX([DFXX,DFXY,DFXZ],[DFXY,DFYY,DFYZ],
- [DFXZ,DFYZ,DFZZ])));
- HESSIAN(F):=BLOCK([DFXX,DFXY,DFXZ,DFYY,DFYZ,DFZZ],DFXX:DIFF(F,X,2),
- DFXY:DIFF(F,X,1,Y,1),DFXZ:DIFF(F,X,1,Z,1),DFYY:DIFF(F,Y,2),
- DFYZ:DIFF(F,Y,1,Z,1),DFZZ:DIFF(F,Z,2),
- DETERMINANT(MATRIX([DFXX,DFXY,DFXZ],[DFXY,DFYY,DFYZ],
- [DFXZ,DFYZ,DFZZ])))$
- KILL(X,Y,Z);
- DONE$
- HESSIAN(X^3-3*A*X*Y*Z+Y^3);
- -3*A*Y*(9*A^2*X*Z+18*A*Y^2)-27*A^3*X*Y*Z-54*A^2*X^3$
- SUBST(1,Z,QUOTIENT(%,-54*A^2));
- Y^3+A*X*Y+X^3$
- F(X):=BLOCK([a,Y],LOCAL(A),Y:4,A[Y]:X,DISPLAY(A[Y]));
- F(X):=BLOCK([a,Y],LOCAL(A),Y:4,A[Y]:X,DISPLAY(A[Y]))$
- Y:2;
- 2$
- A[Y+2]:0;
- 0$
- F(9);
- DONE$
- A[Y+2];
- 0$
-